package com.nuedu.corejava.ch8.homework;

import java.util.Scanner;

public class TestMyexception {
	private int a;

	public TestMyexception() {
		super();
	
	}

	public TestMyexception(int a) {
		super();
		this.a = a;
	}
	void test() throws ByteSizeException{
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入一个数字");
		a = scanner.nextInt();
		if (a>127||a<-128) {
			throw new ByteSizeException("输入的数字不是byte类型");
		}else {
			System.out.println(a);
		}
		
		
	}

	
	public static void main(String[] args) {
		TestMyexception nMyexception = new TestMyexception();
		try {
			nMyexception.test();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
